<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>CST425 Lunch Finder Project</title>
<script
	src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAcsy7w2iPOeCVj6Qc887CmhTJhbfH0KzW1jHHcvrCnjElnKpj9hSrDfgpNxoZA0mtAdt_sXfLetaB6g"
	type="text/javascript"></script>
<script
	src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCity,GeobytesCode"
	type="text/javascript"></script>
<script src="lib/lunchfinder.js" type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div style="text-align: center;">
<table
	style="width: 400px; text-align: center; margin-left: auto; margin-right: auto;"
	border="0" cellpadding="2" cellspacing="2">
	<tbody>
		<tr>
			<td><b>Lunch Finder</b></td>
		</tr>
	</tbody>
</table>
<br />
<form name="form1">
<table
	style="width: 400px; text-align: left; margin-left: auto; margin-right: auto;"
	border="1" cellpadding="2" cellspacing="2">
	<tbody>
		<tr>
			<td>Your Location:</td>
			<td>City:&nbsp; <input name="city" size="6" /><br />
			State:&nbsp; <input name="state" size="1" maxlength="2" /></td>
		</tr>
		<tr>
			<td>Price Range:</td>
			<td>Min: $&nbsp;<input name="min" size="3" maxlength="7" /><br />
			Max: $&nbsp; <input name="max" size="3" maxlength="7" /></td>
		</tr>
		<tr>
			<td>Maximum Distance:</td>
			<td><input name="maxdist" size="3" maxlength="4" />&nbsp; mi</td>
		</tr>
		<tr>
			<td>Food Type:</td>
			<td><select name="foodtype">
				<option>Any</option>
				<option>Chinese</option>
				<option>Mexican</option>
				<option>Italian</option>
				<option>Indian</option>
			</select></td>
		</tr>
	</tbody>
</table>
<br />
<table
	style="width: 400px; text-align: center; margin-left: auto; margin-right: auto;"
	border="0" cellpadding="2" cellspacing="2">
	<tbody>
		<tr>
			<td><input type="button" name="find" value="Where's Lunch?"
				onClick="findStartLocation()" /></td>
		</tr>
	</tbody>
</table>
</form>
<div id="map" style="width: 500px; height: 300px"></div>
</div>
<script type="text/javascript">load();</script>

<? 
include_once 'lib/config.php';
include_once 'lib/databaseObject.php';

$dbObj = new DatabaseObject();
$dbObj->connect($dbhost, $dbuser, $dbpass, $dbname);

$min = $_GET['min'];
$max = $_GET['max'];

if(!isset($min))
	$min = 0;
	
$myArray = $dbObj->getLunchByPrice(0,8); //$min,$max

$restaurant = $myArray[0];
$menuItems = $myArray[1];

$x = $myArray[1];

echo $x[0];

//[{"array":[json]}]

echo "<script language=\"javascript\"> hello();</script>";
//echo "<script language=\"javascript\"> findStartLocation();</script>";
echo "<script language=\"javascript\"> findLocations(" . $restaurant . "," . $menuItems . ");</script>";

?>
</body>
</html>
